package com.sourceQ.system.controller.message.mail;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sourceQ.common.core.domain.R;
import com.sourceQ.common.core.web.controller.BaseController;
import com.sourceQ.common.core.web.domain.AjaxResult;
import com.sourceQ.system.domain.message.mail.SysMailLog;
import com.sourceQ.system.dto.message.MailLogPageReqDTO;
import com.sourceQ.system.service.message.mail.SysMailLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author: SourceQ
 * @create: 2024-04-28 17:16
 * @Description:
 */
@RestController
@RequestMapping("/mail-log")
@Api(tags = "邮件记录管理")
public class MailLogController extends BaseController {
    @Autowired
    private SysMailLogService mailLogService;
    @GetMapping("/page")
    @ApiOperation("获得邮箱日志分页")
    public R<IPage<SysMailLog>> getMailLogPage(Page page, MailLogPageReqDTO pageVO) {
        return R.ok(mailLogService.getMailLogPage(page, pageVO));
    }

    @GetMapping("/detail/{id}")
    @ApiOperation("获得邮箱日志")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public AjaxResult getMailTemplate(@PathVariable Long id) {
        return success(mailLogService.getMailLog(id));
    }
}
